package com.cloud.dao.impl;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Component;

import com.cloud.core.BaseDao;
import com.cloud.dao.RatingBean;

/**
 * 1Cloud1
 * @author Administrator
 * @since 2015-12-4
 * @version 1.0 
 */
@Component("RatingDao")
public class RatingDao extends BaseDao {
	
	public List<RatingBean> getRatingList(RatingBean bean){
		SqlSession session = super.getInstance(true);
		List<RatingBean> beanList = null;
		try {
			beanList = session.selectList("rating.list", bean);
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			session.close();
		}
		return beanList;
	}
	
	public void addRating(RatingBean bean){
		SqlSession session = super.getInstance(true);
		session.insert("rating.insert", bean);
		session.close();
	}
	
	/**
	 * 修改图片
	 * @param bean
	 */
	public void updateRating(RatingBean bean){
		SqlSession session = super.getInstance(true);
		session.update("rating.update", bean);
		session.close();
	}
	
	/**
	 * 删除图片
	 * @param bean
	 */
	public void deleteRating(RatingBean bean){
		SqlSession session = super.getInstance(true);
		session.delete("rating.delete", bean);
		session.close();
	}
}
